package com.oguzhan.blog.scheduloor;

import java.util.Comparator;

public class JobComparator implements Comparator<Job> {

	@Override
	public int compare(Job job1, Job job2) {
		
		if (job1 != null && job2 != null) {
			if (job1.getScheduled().after(job2.getScheduled())) {
				return 1;
			}
			else if (job1.getScheduled().before(job2.getScheduled())) {
				return -1;
			}
			else {
				return 0;
			}
		}
		
		throw new IllegalArgumentException("Null Job Objects Cannot be Compared!");
		
	}

}
